package com.example.qxfw.nyqx.controller;

import com.example.qxfw.common.SysResult;
import com.example.qxfw.common.entity.ny.QhCropIndex;
import com.example.qxfw.common.entity.ny.QhYz;
import com.example.qxfw.common.entity.ny.QhYzDisppara;
import com.example.qxfw.common.entity.ny.QhYzpz;
import com.example.qxfw.common.entity.qx.MgfxYz;
import com.example.qxfw.common.entity.qx.MgfxYzDisppara;
import com.example.qxfw.common.entity.yj.ZhqhYz;
import com.example.qxfw.common.entity.yj.ZhqhYzDisppara;
import com.example.qxfw.nyqx.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@ApiIgnore
@Api(tags = "农业气象-辅助配置")
@RestController
@CrossOrigin
@RequestMapping("/AuxiliaryConfigurationController")
public class AuxiliaryConfigurationController {

    @Autowired
    private QhCropIndexService qhCropIndexService;

    @Autowired
    private QhYzpzService qhYzpzService;

    @Autowired
    private QhYzDispparaService qhYzDispparaService;

    @Autowired
    private QhYzService qhYzService;

    @Autowired
    private ZhqhYzDispparaService zhqhYzDispparaService;

    @Autowired
    private ZhqhYzService zhqhYzService;

    @Autowired
    private MgfxYzDispparaService mgfxYzDispparaService;

    @Autowired
    private MgfxYzService mgfxYzService;

    @ApiOperation("")
    @GetMapping("/getQhCropIndex")
    public SysResult getQhCropIndex(){
        List<QhCropIndex> list = qhCropIndexService.getList();
        return SysResult.success(list);
    }

    @ApiOperation("")
    @GetMapping("/getQhCropIndex1")
    public SysResult getQhCropIndex1(String layerName,String analyseName){
        List<QhCropIndex> list = qhCropIndexService.getList1(layerName, analyseName);
        return SysResult.success(list);
    }

    @ApiOperation("")
    @GetMapping("/getQhYzpz")
    public SysResult getQhYzpz(String factorIndex){
        List<QhYzpz> list = qhYzpzService.getList(factorIndex);
        return SysResult.success(list);
    }

    @ApiOperation("")
    @GetMapping("/getQhYzpz1")
    public SysResult getQhYzpz1(String factorIndex,String fieldValue){
        List<QhYzpz> list1 = qhYzpzService.getList1(factorIndex, fieldValue);
        return SysResult.success(list1);
    }

    @ApiOperation("")
    @PostMapping ("/saveQhYzpz")
    public SysResult saveQhYzpz(QhYzpz qhYzpz){
        Integer rows = qhYzpzService.save(qhYzpz);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @PostMapping("/updateQhYzpz")
    public SysResult updateQhYzpz(QhYzpz qhYzpz){
        Integer rows = qhYzpzService.update(qhYzpz);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/deleteQhYzpz")
    public SysResult deleteQhYzpz(String factorIndex,String fieldValue){
        Integer rows = qhYzpzService.delete(factorIndex,fieldValue);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/getQhYzDisppara")
    public SysResult getQhYzDisppara(String factorIndex){
        List<QhYzDisppara> list = qhYzDispparaService.getList(factorIndex);
        return SysResult.success(list);
    }

    @ApiOperation("")
    @PostMapping("/saveQhYzDisppara")
    public SysResult saveQhYzDisppara(QhYzDisppara qhYzDisppara){
        Integer rows = qhYzDispparaService.save(qhYzDisppara);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/deleteQhYzDisppara")
    public SysResult deleteQhYzDisppara(String id){
        Integer rows = qhYzDispparaService.delete(id);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @PostMapping("/updateQhYzDisppara")
    public SysResult updateQhYzDisppara(QhYzDisppara qhYzDisppara){
        Integer rows = qhYzDispparaService.update(qhYzDisppara);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/getQhYz")
    public SysResult getQhyz(String factorIndex){
        List<QhYz> qhYzs = qhYzService.getList(factorIndex);
        return SysResult.success(qhYzs);
    }

    @ApiOperation("")
    @PostMapping("/updateQhYz")
    public SysResult updateQhYz(QhYz qhYz){
        Integer rows = qhYzService.update(qhYz);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/getZhqhDisppara")
    public SysResult getZhqhDisppara(String factorIndex){
        List<ZhqhYzDisppara> list = zhqhYzDispparaService.getList(factorIndex);
        return SysResult.success(list);
    }

    @ApiOperation("")
    @PostMapping("/saveZhqhDisppara")
    public SysResult saveZhqhDisppara(ZhqhYzDisppara zhqhYzDisppara){
        Integer rows = zhqhYzDispparaService.save(zhqhYzDisppara);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/deleteZhqhDisppara")
    public SysResult deleteZhqhDisppara(String id){
        Integer rows = zhqhYzDispparaService.delete(id);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @PostMapping("/updateZhqhDisppara")
    public SysResult updateZhqhDisppara(ZhqhYzDisppara zhqhYzDisppara){
        Integer rows = zhqhYzDispparaService.update(zhqhYzDisppara);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/getZhqhYz")
    public SysResult getZhqhYz(String factorIndex){
        List<ZhqhYz> list = zhqhYzService.getList(factorIndex);
        return SysResult.success(list);
    }

    @ApiOperation("")
    @PostMapping("/updateZhqhYz")
    public SysResult updateZhqhYz(ZhqhYz zhqhYz){
        Integer rows = zhqhYzService.update(zhqhYz);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/getMgfxYzDisppara")
    public SysResult getMgfxYzDisppara(String factorIndex){
        List<MgfxYzDisppara> list = mgfxYzDispparaService.getList(factorIndex);
        return SysResult.success(list);
    }

    @ApiOperation("")
    @PostMapping("/updateMgfxYzDisppara")
    public SysResult updateMgfxYzDisppara(MgfxYzDisppara mgfxYzDisppara){
        Integer rows = mgfxYzDispparaService.update(mgfxYzDisppara);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @PostMapping("/saveMgfxYzDisppara")
    public SysResult saveMgfxDisppara(MgfxYzDisppara mgfxYzDisppara){
        Integer rows = mgfxYzDispparaService.save(mgfxYzDisppara);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/deleteMgfxYzDisppara")
    public SysResult deleteMgfxDisppara(String id){
        Integer rows = mgfxYzDispparaService.delete(id);
        return SysResult.success(rows);
    }

    @ApiOperation("")
    @GetMapping("/getMgfxYz")
    public SysResult getMgfxYz(){
        List<MgfxYz> list = mgfxYzService.getList();
        return SysResult.success(list);
    }

    @ApiOperation("")
    @PostMapping("/updateMgfxYz")
    public SysResult updateMgfxYz(MgfxYz mgfxYz){
        Integer rows = mgfxYzService.update(mgfxYz);
        return SysResult.success(rows);
    }
}
